package test.doubleindex;

public class Solution {
    public ListNode deleteDuplicates(ListNode head) {
        // 在此处写入代码

        ListNode current = head;

        while (current != null && current.next != null) {
            if (current.next.val == current.val) {
                current.next = current.next.next;
            } else {
                current = current.next;
            }
        }
        return head;
    }

    public class ListNode {
        int val;
        ListNode next;
        ListNode(int x) { val = x; }
   }
}
